package com.gitee.huanminabc.validate;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * @description:  校验费率是否合法, 一般前传入的是百分比不是小数,我们只需要判断是否在0-100之间
 * @author: huanmin
 * @create: 2025-04-23 16:16
 **/
@Documented
@Constraint(validatedBy = { FeeRateLegalValidator.class })
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE })
@Retention(RUNTIME)
public @interface FeeRateLegal {
    String message() default "费率不合法";

    Class<?>[] groups() default { };

    Class<? extends Payload>[] payload() default { };
    double max() default 100; //一般现实中费用率都是在0-100之间
    double min() default 0;
}
